package com.hpli.domain.award.model.aggregate;


import com.hpli.domain.award.model.entity.UserAwardRecordEntity;
import com.hpli.domain.award.model.entity.UserCreditAwardEntity;
import com.hpli.domain.award.model.valobj.AwardStateVO;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * @Author: 汀
 * @CreateTime: 2025-04-21
 * @Description: 分发奖品聚合对象
 * @Version: 1.0
 */

@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class GiveOutPrizesAggregate {

    /**
     * 用户Id
     */
    private String userId;

    /**
     * 用户发奖记录
     */
    private UserAwardRecordEntity userAwardRecordEntity;

    /**
     * 用户积分奖品
     */
    private UserCreditAwardEntity userCreditAwardEntity;

    public static UserAwardRecordEntity buildDistributeUserAwardRecordEntity(String userId, String orderId, Integer awardId, AwardStateVO awardState) {
        UserAwardRecordEntity userAwardRecord = new UserAwardRecordEntity();
        userAwardRecord.setUserId(userId);
        userAwardRecord.setOrderId(orderId);
        userAwardRecord.setAwardId(awardId);
        userAwardRecord.setAwardState(awardState);
        return userAwardRecord;
    }

    public static UserCreditAwardEntity buildUserCreditAwardEntity(String userId, BigDecimal creditAmount) {
        UserCreditAwardEntity userCreditAward = new UserCreditAwardEntity();
        userCreditAward.setUserId(userId);
        userCreditAward.setCreditAmount(creditAmount);
        return userCreditAward;
    }
}
